
package com.zjxd.business.web.initialize;

import java.util.Map;

import org.springframework.boot.CommandLineRunner;
import org.springframework.core.annotation.Order;
import org.springframework.stereotype.Component;

import com.zjxd.business.web.code.MapCode;
import com.zjxd.business.web.utils.MapUtils;
import com.zjxd.business.web.utils.RSAUtils;

/**
 * 初始化生成公钥私钥
 * 
 * @author QIk
 */
@Component
@Order(value = 0)
public class StartRun implements CommandLineRunner {

	@Override
	public void run(String... arg0) throws Exception {

		Map<String, String> map = RSAUtils.createKeys(1024);
		MapUtils.set(MapCode.PRIVATE_KEY_STR_NAME, map.get("privateKey"));
		MapUtils.set(MapCode.PUBLIC_KEY_STR_NAME, map.get("publicKey"));
		MapUtils.set(MapCode.RSA_KEY_CREATE_TIME, System.currentTimeMillis());
	}
}
